<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->

<link href="<%=basePath %>resources/css/bootstrap.min.css"
	rel="stylesheet" media="screen">
<script src="<%=basePath %>resources/jslib/jquery.js"></script>
<script src="<%=basePath %>resources/jslib/bootstrap.min.js"></script>
<script type="text/javascript">

//登录
	function saveDeviceInfo() {
		$("#mes").show();
		$("#mes").html("&nbsp;&nbsp;正在通讯中...");
		
		var tuzimingchen=$("#tuzimingchen").val();
		if(tuzimingchen.length<0){
			$("#mes").html("&nbsp;&nbsp;图纸名称不能为空");
			return ;
		}
		
		var tuzibianhao=$("#tuzibianhao").val();
		if(tuzibianhao.length<0){
			$("#mes").html("&nbsp;&nbsp;图纸编号不能为空");
			return ;
		}
		
		
		var xingHao=$("#designxingHao").val();
		if(xingHao.length<0){
			$("#mes").html("&nbsp;&nbsp;图纸型号不能为空");
			return ;
		}
		
		var sheJiRen=$("#sheji").val();
		if(sheJiRen.length<0){
			$("#mes").html("&nbsp;&nbsp;设计人信息不能为空");
			return ;
		}
		
		var shenHeRen=$("#shenhe").val();
		if(shenHeRen.length<0){
			$("#mes").html("&nbsp;&nbsp;审核人信息不能为空");
			return ;
		}
		
		
		var caigouInfo=$("#zhitu").val();
		if(caigouInfo.length<0){
			$("#mes").html("&nbsp;&nbsp;制图人信息不能为空");
			return ;
		}
		
		//登录处理
		var param={"lingJianID":$("#lingJianId").val(),
				"name":$("#tuzimingchen").val(),
				"xingHao":$("#designxingHao").val(),
				"tuZhiBianHao":$("#tuzibianhao").val(),
				"sheJiRen":$("#sheji").val(),
				"shenHeRen":$("#shenhe").val(),
				  "zhiTuRen":$("#zhitu").val()
				  };
		$.ajax({
			type: "post",
			contentType: "application/json;charset=utf-8",
			url : "<%=basePath %>lingJian/addDesignInfo.action",
			data :JSON.stringify(param) ,
			success : function(data){
                       if(data.code=="0000"){
	                          alert("添加成功"); 
	                          $("#mes").html("&nbsp;&nbsp;添加成功，请继续添加...");
	                       }else{
	                          $("#mes").html(data.code+"##"+data.message);
	                        }
                      
             },
			 dataType : "json"
		});
	}
</script>
</head>
<body>
	<ol class="breadcrumb">
		<li><a href="#">登陆</a></li>
		<li><a href="#">首页</a></li>
		<li class="active">零件设计信息详情添加</li>
	</ol>


	<form class="form-horizontal" role="form">

		<input class="form-control" id="lingJianId" type="hidden"
			value="${lingJian.id }">
		<div class="form-group">
			<label class="col-sm-2 control-label">零件编号：</label>
			<div class="col-sm-10">
				<input class="form-control" readonly="readonly" id="bianHao"
					type="text" value="${lingJian.bianHao }">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">零件名称：</label>
			<div class="col-sm-10">
				<input class="form-control" id="deviceName" readonly="readonly"
					type="text" value="${lingJian.name }">
			</div>
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label">零件型号：</label>
			<div class="col-sm-10">
				<input class="form-control" id="xingHao" readonly="readonly"
					type="text" value="${lingJian.xingHao }">
			</div>
		</div>



		<div class="form-group">
			<label class="col-sm-2 control-label">图纸名称：</label>
			<div class="col-sm-10">
				<input class="form-control" id="tuzimingchen" placeholder="请输入操作者信息"></input>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">图纸型号：</label>
			<div class="col-sm-10">
				<input class="form-control" id="designxingHao" placeholder="请输入图纸型号"></input>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">图纸编号：</label>
			<div class="col-sm-10">
				<input class="form-control" id="tuzibianhao" placeholder="请输入图纸编号"></input>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">设计人信息：</label>
			<div class="col-sm-10">
				<input class="form-control" id="sheji" placeholder="请输入设计人信息"></input>
			</div>
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label">制图人信息：</label>
			<div class="col-sm-10">
				<input class="form-control" id="zhitu" placeholder="请输入采购材料型号"></input>
			</div>
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label">审核人信息：</label>
			<div class="col-sm-10">
				<input class="form-control" id="shenhe" placeholder="请输入采购材料型号"></input>
			</div>
		</div>


		<div class="form-group">
			<label class="col-sm-2 control-label" for="inputSuccess"></label>
			<button type="button" class="btn btn-success"
				onclick="saveDeviceInfo()">确认保存</button>

		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="inputSuccess"></label>
			<p class="text-success" id="mes"></p>
		</div>
	</form>

</body>
</html>